package com.dykj.fireFighting.common.core.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: zly
 * @Description : 到此时的分钟差
 * @Date: 2021-08-13
 */
public class MinutesDiffToNow {

    public static Long getMinutesDiff(Date fromDate) throws ParseException {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long currentTime =System.currentTimeMillis();
        long upTimeMillis = dateFormat.parse(dateFormat.format(fromDate)).getTime();
        long diff=(currentTime-upTimeMillis)/1000/60;
        return diff;
    }
}
